<?php

/**
 * UserProfile form base class.
 *
 * @method UserProfile getObject() Returns the current form's model object
 *
 * @package    rrtk
 * @subpackage form
 * @author     irh
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseUserProfileForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'          => new sfWidgetFormInputHidden(),
      'user_id'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('sfGuardUser'), 'add_empty' => false)),
      'first_name'  => new sfWidgetFormInputText(),
      'father_name' => new sfWidgetFormInputText(),
      'last_name'   => new sfWidgetFormInputText(),
      'occupation'  => new sfWidgetFormInputText(),
      'birthday'    => new sfWidgetFormDate(),
      'img_uri'     => new sfWidgetFormInputText(),
      'about'       => new sfWidgetFormTextarea(),
      'sex_id'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Sex'), 'add_empty' => true)),
      'skype'       => new sfWidgetFormInputText(),
      'icq'         => new sfWidgetFormInputText(),
      'phone'       => new sfWidgetFormInputText(),
      'site'        => new sfWidgetFormInputText(),
      'created_at'  => new sfWidgetFormDateTime(),
      'updated_at'  => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'          => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'user_id'     => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('sfGuardUser'))),
      'first_name'  => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'father_name' => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'last_name'   => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'occupation'  => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'birthday'    => new sfValidatorDate(array('required' => false)),
      'img_uri'     => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'about'       => new sfValidatorString(array('required' => false)),
      'sex_id'      => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Sex'), 'required' => false)),
      'skype'       => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'icq'         => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'phone'       => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'site'        => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'created_at'  => new sfValidatorDateTime(),
      'updated_at'  => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('user_profile[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'UserProfile';
  }

}
